package com.cloudwise.monitoring_system.util;

import org.springframework.stereotype.Component;
import redis.clients.jedis.JedisCluster;

import javax.annotation.Resource;

/**
 * @author Reisen
 * @description:链接redis工具类
 * @date 2021/6/7 11:22
 */
@Component
public class MyRedisUtil {

    @Resource
    private RedisClusterConnection redisClusterConnection;

    /**
     * 链接redis集群方法
     * @param key
     * @return
     */
    public String getValue(String key){
        //连接redis集群
        JedisCluster jedisCluster = new JedisCluster(redisClusterConnection.getRedisClusters());
        //获取key值
        String value = jedisCluster.get(key);
        return value;
    }
}
